package net.homelinux.chaoswg.io.renga.core.registries;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

import net.homelinux.chaoswg.io.renga.core.gui.operations.VariablePutOperation;

public final class VariableRegistry {
    private static Map<String, VariablePutOperation> _mapping = null;
    private static VariableRegistry _this = null;
    
    private VariableRegistry () {
        _mapping = new HashMap<String, VariablePutOperation>();
    }
    
    public final static VariableRegistry getVariableRegistry () {
        if (_this == null) {
            _this = new VariableRegistry ();
        }
        
        return _this;
    }
    
    public final VariablePutOperation getVariablePut (final String name) {
        return _mapping.get(name);
    }
    
    public final void setVariablePut (final String name, final VariablePutOperation variablePut) {
        _mapping.put (name, variablePut);
    }
    
    public final void removeVariablePut (final String name) {
        _mapping.remove(name); 
    }
    
    public final Set<String> getPossible () {
        return new TreeSet<String>(_mapping.keySet());
    }
}
